﻿@model IEnumerable<Kavaa.Modules.PortailMedical.Entity.Accreditation>
@using System.Web.Optimization
@using BootstrapSupport
@using NavigationRoutes

@{
    ViewBag.Title = "Accreditations";
    Layout = null;
}
<!DOCTYPE html>
@if (Session["user"] != null)
{
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>@ViewBag.Title</title>
        @*<meta name="viewport" content="width=device-width, initial-scale=1.0">*@
        <link href="@Styles.Url("~/content/css")" rel="stylesheet"/>
        <link href="@Styles.Url("~/Content/css-responsive")" rel="stylesheet" type="text/css" />
        @*@RenderSection("head", required: false)*@
        @Html.Partial("_html5shiv")
        @* favicons and touch icons go here *@
        @Scripts.Render("~/js")


        <script>
            var rowId;

            /* Table initialisation */
            $(document).ready(function () {
                $('#example').dataTable({
                    "sDom": "<'row'<'span4'l><'span4'f>r>t<'row'<'span4'i><'span4'p>>",
                    "sPaginationType": "bootstrap"
                });
            });



            function reject() {

                $('.mytable tr').click(function (e) {
                    rowId = $(this).attr('id');
                });

            }
            function reject2() {
              
                $.ajax({
                    url: '/Clinique/RejectAccredit',//ça marche
                    async: false,
                    type: 'POST',
                    data: { idAccredit: rowId },
                    success: function () {
                        $('#reject').attr('data-dismiss', 'modal');
                        $('#lala').load('/Clinique/TraiterAccredit');
                    }
                });
                document.getElementById("t").style.display = "block";

            }

            function confirm() {
                $('.mytable tr').click(function (e) {
                    rowId = $(this).attr('id');

                });


            }

            function confirm2() {
      
                $.ajax({
                    url: '/Clinique/ConfirmAccredit',//ça marche
                    async: false,
                    type: 'POST',
                    data: { idAccredit: rowId },
                    success: function () {
                        $('#confirm').attr('data-dismiss', 'modal');
                        $('#lala').load('/Clinique/TraiterAccredit');
                    }
                });
                document.getElementById("t").style.display = "block";

            }
        </script>
       

        <style>
             .form-signin {
        
        padding: 19px 29px 29px;
        margin: 0 auto 20px;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
      }
        
             
             .btn-custom {
  background-color: hsl(145, 62%, 68%) !important;
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#cdf3dd", endColorstr="#7adfa4");
  background-image: -khtml-gradient(linear, left top, left bottom, from(#cdf3dd), to(#7adfa4));
  background-image: -moz-linear-gradient(top, #cdf3dd, #7adfa4);
  background-image: -ms-linear-gradient(top, #cdf3dd, #7adfa4);
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #cdf3dd), color-stop(100%, #7adfa4));
  background-image: -webkit-linear-gradient(top, #cdf3dd, #7adfa4);
  background-image: -o-linear-gradient(top, #cdf3dd, #7adfa4);
  background-image: linear-gradient(#cdf3dd, #7adfa4);
  border-color: #7adfa4 #7adfa4 hsl(145, 62%, 63%);
  color: #333 !important;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.33);
  -webkit-font-smoothing: antialiased;
}

             .btn-custom2 {
  background-color: hsl(0, 100%, 69%) !important;
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ff9e9e", endColorstr="#ff6060");
  background-image: -khtml-gradient(linear, left top, left bottom, from(#ff9e9e), to(#ff6060));
  background-image: -moz-linear-gradient(top, #ff9e9e, #ff6060);
  background-image: -ms-linear-gradient(top, #ff9e9e, #ff6060);
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff9e9e), color-stop(100%, #ff6060));
  background-image: -webkit-linear-gradient(top, #ff9e9e, #ff6060);
  background-image: -o-linear-gradient(top, #ff9e9e, #ff6060);
  background-image: linear-gradient(#ff9e9e, #ff6060);
  border-color: #ff6060 #ff6060 hsl(0, 100%, 66%);
  color: #333 !important;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.19);
  -webkit-font-smoothing: antialiased;
}
             
             
             
             
             
             
             
             </style>
         <div class="navbar navbar-inverse navbar-top" >
           <div class="navbar-inner">
        </div>       
            </div>
               <div class="container">
     @{
         
         
    var prenomuser = ((Kavaa.Modules.PortailMedical.Entity.Utilisateur)(Session["user"])).Prenom;
    var nomuser = ((Kavaa.Modules.PortailMedical.Entity.Utilisateur)(Session["user"])).Name;}
          <table class="container">
              <tr>
                  <td>
            <img src="/Content/images/mediciMaroc.png" /> </td>
                  <td class="pull-right">
                      <br />
            <p style="text-align:right"><i class=" icon-user"> </i>&nbsp; &nbsp; @prenomuser  @nomuser  &nbsp; &nbsp;  @Html.ActionLink("Se déconnecter", "Deconnexion")&nbsp; &nbsp; </p>
               </td>
           
        
        </tr>
        </table>
                   </div>
    </head>
   
    <body style="padding:0px; background-color:#fafafa">
       

        <div class="container">
            @Html.Partial("_alerts")
            @Html.Partial("_validationSummary")
           
        
     <!-- Main hero unit for a primary marketing message or call to action -->

  

<div id="result">
    

<div class="container" style="background-color:white">
   <div class="navbar">
   <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
          <div class="nav-collapse collapse">
        <ul class="nav">
    <li> @Html.ActionLink("Accueil","AccueilClinique")</li>
      <li  class="active"> @Html.ActionLink("Accréditations","Accreditations")</li>
      <li>@Html.ActionLink(" Réservations","Reservations")</li>
      <li>@Html.ActionLink("Gérer Ressources","GererRessources")</li>
      <li>@Html.ActionLink("Admission des patients","AdmissionPatient")</li>
      <li>@Html.ActionLink("Comptes Clinique","ComptesClinique")</li>

    </ul>
  <form class="navbar-search pull-right">
      <i class="icon-search"></i>
  <input type="text" class="search-query" placeholder="Search">
</form>
              </div>
          </div>
  </div>
           
</div>
    <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;La liste dessous présente les demandes d'accréditation chez votre clinique et qui ne sont pas encore traitées:
    <br />
    <br />
          <div id="t" class = "alert alert-success" style="margin-left:22px; margin-right:700px;display:none">
          
   <button type="button" class="close" data-dismiss="alert">&times;</button>
  <div id="tttt"> Votre traitement de la demande a été bien enregistré. </div>
   
</div>
      <!-- Example row of columns -->
    
     <div id="lala">
    
     <div style="margin-left:50px; margin-right:300px;">
         
                    
<table class="mytable table table-striped table-bordered" id="example">

  <thead>   
         <tr></tr> 
        <tr></tr>  
		<tr>
        <th>INP</th>
			<th>Medecin</th>
			<th>Acte</th>
			<th>Date de demande </th>
            <th>Traitement</th>
            
		</tr>
	</thead>
	<tbody>

@foreach (var item in Model)
{
    
    <tr id=@item.Id>
          <td >
    
        
            @Html.DisplayFor(modelItem => item.Medecin.INP)
           
        </td>
        <td >
    
        
          Dr.&nbsp;@Html.DisplayFor(modelItem => item.Medecin.Name)&nbsp;@Html.DisplayFor(modelItem => item.Medecin.Prenom)
           
        </td>
        <td>
           @Html.DisplayFor(modelItem => item.Acte.Name) 
               </td>
            
       <td>
         @Html.DisplayFor(modelItem => item.Date)<br />
         
         
             </td>
       

          
        <td>
           @{var tata = @item.Id;} @*<input  onclick="confirm()" />*@

            
                 <a href="#popup_Confirm" data-toggle="modal"> <button  style="background-color:green" onclick="confirm()"  class="btn btn-custom"><i class="icon-white icon-ok"></i> Confirmer</button> </a>      <a href="#popup_Reject" data-toggle="modal"> <button style="background-color:red" onclick="reject()"  class="btn btn-custom2"><i class=" icon-remove"></i> Rejeter</button></a>
           <br />
           @*  @using (Ajax.BeginForm("TraiterAccredit", "Clinique", new AjaxOptions { UpdateTargetId = "lala" , OnSuccess="totooo"}))
      {
            *@
     
              
     @* //}*@
          
             </td>

      
   
    </tr>
     
    
}

        
   
</tbody>
</table>

       <div id="popup_Reject" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="popupLabel" aria-hidden="true" >
          
               <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                
              </div>
              <br /><br />
              <div id="msgSupp" style="padding-left:10px" > Voulez-vous vraiment rejeter cette demande ?</div>
              <br /><br />
               <div class="modal-footer">
           <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
           <button id= "reject" class="btn btn-primary" onclick="reject2()"> Rejeter</button>
            </div>
              </div> 
      
       <div id="popup_Confirm" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="popupLabel"  aria-hidden="true" >
          
               <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                
              </div>
              <br /><br />
              <div style="padding-left:10px" >Voulez-vous vraiment confirmer cette demande ?</div>
              <br /><br />
               <div class="modal-footer">
           <button class="btn" data-dismiss="modal" aria-hidden="true" >Annuler</button>
         <button id="confirm" class="btn btn-primary" onclick="confirm2()" > Confirmer </button>
         
            </div>
         
              </div>       
         <br />
   
</div>

</div>

  
  
  
    </div>


</div>
 
            <hr>
            <footer>
                <p>&copy; Kavaa @System.DateTime.Now.ToString("yyyy")</p>
            </footer> 
        </div>
       @*  @Scripts.Render("~/js")*@
        @* @RenderSection("Scripts", required: false)*@
    </body>
</html>
}
else
{
 
  <h5>  Pour pouvoir accéder à cette page veuillez vous connecter :  @Html.ActionLink("Se connecter", "SignIn", "test") </h5>

}